﻿<UserControl 
    x:Class="XamlaApp.XamlaMainPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
    xmlns:uiviews="clr-namespace:XamlaApp.Views.UIViews" 
    xmlns:basics="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls" 
    mc:Ignorable="d" d:DesignWidth="1100" d:DesignHeight="700">
    <Grid>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="42"/>
            <ColumnDefinition Width="255" MaxWidth="255"/>
            <ColumnDefinition Width="*"/>
        </Grid.ColumnDefinitions>
        <Grid.RowDefinitions>
            <RowDefinition Height="30"/>
            <RowDefinition Height="*"/>
        </Grid.RowDefinitions>
        <StackPanel Grid.ColumnSpan="3" Orientation="Horizontal">
            <Button Style="{StaticResource xamla_menustrip_button}" Content="New" x:Name="btnNew" Click="btnNew_Click"></Button>
            <Button Style="{StaticResource xamla_menustrip_button}" Content="Save Project..." x:Name="btnSave" Click="btnSave_Click" ></Button>
            <Button Style="{StaticResource xamla_menustrip_button}" Content="Load Project..." x:Name="btnLoad" Click="btnLoad_Click" ></Button>
            <Button Style="{StaticResource xamla_menustrip_button}" Content="Export Xaml" x:Name="btnExportXaml" Click="btnExportXaml_Click" Visibility="{Binding ProjectHasElements, Converter={StaticResource VisibilityToBooleanConverterResource}}"></Button>
            <Button Style="{StaticResource xamla_menustrip_button}" Content="Delete Element" Visibility="{Binding ElementSelected, Converter={StaticResource VisibilityToBooleanConverterResource}}" x:Name="btnDeleteActiveElement" Click="btnDeleteActiveElement_Click"></Button>
            <Button Style="{StaticResource xamla_menustrip_button}" Content="Cut" Visibility="{Binding ElementSelected, Converter={StaticResource VisibilityToBooleanConverterResource}}" x:Name="btnCut" Click="btnCut_Click"/>
            <Button Style="{StaticResource xamla_menustrip_button}" Content="Copy" Visibility="{Binding ElementSelected, Converter={StaticResource VisibilityToBooleanConverterResource}}" x:Name="btnCopy" Click="btnCopy_Click"/>
            <Button Style="{StaticResource xamla_menustrip_button}" Visibility="{Binding CutCopyBufferOccupied, Converter={StaticResource VisibilityToBooleanConverterResource}}" x:Name="btnPaste" Click="btnPaste_Click">
                <Button.Content>
                    <StackPanel Orientation="Horizontal">
                        <TextBlock Margin="5,0,0,0" VerticalAlignment="Center" Text="Paste"></TextBlock>
                        <Border Margin="5,0,0,0" BorderBrush="LightGray" BorderThickness="1">
                            <Image Width="20" Height="20" Source="{Binding BufferedElementPreview, Mode=OneWay}" Stretch="Uniform"></Image>
                        </Border>
                    </StackPanel>
                </Button.Content>
                <ToolTipService.ToolTip>
                    <Image Width="100" Height="100" Source="{Binding BufferedElementPreview, Mode=OneWay}" Stretch="Uniform"></Image>
                </ToolTipService.ToolTip>
            </Button>
            <Button Style="{StaticResource xamla_menustrip_button}" Content="Export To Image Viewer" Visibility="{Binding ImageViewerAvailable, Converter={StaticResource VisibilityToBooleanConverterResource}}" x:Name="btnExportToImageViewer" Click="btnExportToImageViewer_Click"  />
        </StackPanel>
        <basics:GridSplitter HorizontalAlignment="Left" Width="5" Grid.Column="2" Grid.Row="1"/>
        <Grid Grid.Row="1" Style="{StaticResource xamla_gridtools_container}">
            <uiviews:ElementMenuBar HorizontalAlignment="Center" VerticalAlignment="Top"/>
        </Grid>
        <basics:TabControl TabStripPlacement="Bottom" Grid.Row="1" Grid.Column="1" Width="255">
            <basics:TabItem Header="Properties">
                <ScrollViewer HorizontalScrollBarVisibility="Disabled" VerticalScrollBarVisibility="Auto">
                    <StackPanel Background="LightGray" VerticalAlignment="Stretch">
                        <uiviews:MainPropertiesView></uiviews:MainPropertiesView>
                    </StackPanel>
                </ScrollViewer>
            </basics:TabItem>
            <basics:TabItem Header="Elements">
                <ScrollViewer HorizontalScrollBarVisibility="Disabled" VerticalScrollBarVisibility="Auto">
                    <!--TODO: Create a dedicated view and view model for the element list-->
                    <ListBox ItemsSource="{Binding Path='ElementInfoList'}" SelectionChanged="ListBox_SelectionChanged">
                        <ListBox.ItemTemplate>
                            <DataTemplate>
                                <TextBlock Text="{Binding ObjectName}"></TextBlock>
                            </DataTemplate>
                        </ListBox.ItemTemplate>
                    </ListBox>
                </ScrollViewer>
            </basics:TabItem>
        </basics:TabControl>

        <Border Style="{StaticResource xamla_stage_border}" Grid.Column="2">
            <uiviews:MainStageView></uiviews:MainStageView>
        </Border>
    </Grid>
</UserControl>
